
---------------------------------------------------------------------------
Matlab replication code for simulations in Jaravel & Lashkari (QJE, 2023)
---------------------------------------------------------------------------

The "replication_matlab" folder replicates all figures for the simulation exercise (Section 2.4). Please run the two scripts below in the order indicated.

Scripts:
-----------
- script_simulation.m   : this script generates the data and runs the analysis
                          the output are in scructures "res" "resm" and "resp" capturing the results
                          for the case with zero covariance, negative covariance, and positive covariance
                          between inflation and income elasticities
                          the results for different degrees of covariances are in cell structures "resm_l" and "resp_l"
- script_figures.m      : this script uses the results above to create the figures in the paper (Figure 1, C.1-4)

Functions and Classes (called by the scripts):
-------------------------------------------------
- apply_analysis.m      : this function applies the analysis (all algorithms/base periods) for one dataset 
- nhCESdemand.m         : this class defines the nhCES preferences and generates the corresponding (object) demand data
- pihet.m               : this class defines the algorithms and applies them to the (object) data 

---------------------------------------------------------------------------------------
Stata replication code for the empirical analyses in Jaravel & Lashkari (QJE, 2023)
---------------------------------------------------------------------------------------

The "replication_stata" folder replicates all figures for the empirical analysis, except for three appendix figures 
using proprietary Nielsen data.  

To replicate the results, open the master file, “programs/00_script_run_all” and specify the relevant paths. This do.file 
calls all other do.files and generates all figures of the paper, in the main text and in the appendix, with the exception 
of three appendix figures using proprietary Nielsen data. The code is provided for the Nielsen figures but will not run 
without the underlying data.  

The replication code populates the subfolder “results” and “final_figures”. 

All results were generated using State/S.E. 16.1 for Windows.








